package com.mlf.prototype.spring;

import com.mlf.prototype.demo.Orders;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.util.Arrays;

@Configuration
public class AppConfig {
    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) // 关键注解
    public Orders prototypeOrder() {
        Orders orders = new Orders();
        orders.setItems(Arrays.asList("default-item"));
        return orders;
    }
}